class Solution(object):
    def isAnagram(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: bool
        """
        dict1 = {}
        for c in s:
            if c not in dict1:
                dict1.update({c:0})
            dict1[c]+=1
        for c in t:
            if c not in dict1: return False
            elif dict1[c]==0: return False
            else: dict1[c]-=1
        for n in dict1.values():
            if n!=0:return False
        return True